package com.brainydroid.example.motor;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.ArrayList;

import com.brainydroid.framework.Object;
import com.brainydroid.framework.Scene;
import com.brainydroid.framework.Create;

import com.brainydroid.example.motor.Assets;

import com.brainydroid.items.Button;
import com.brainydroid.items.CircularButton;
import com.brainydroid.items.Text_box;



public class ExampleMotor extends Scene{

	
	//--------------------------------------------- Here Variables must be declared

	
	//Button b_target;
	CircularButton b_target;
	
	float screen_onset_time;
	float screen_display_time;
	
	int N_trials_ = 200;

	//--------------------------------------------- Here Variables must be declared

	
	/**
	 * Initialize the experiment. This is where objects should be specified and the spritebatch created
	 */
	public void init_experiments() {
					
		Assets.load(); // loading assets for experimets
		Create.init(this); // Initializing item creation
		
		
		// Item creation 
//		b_target = Create.newButton(10f, 10f,   150f, 150f, 0);
		b_target = Create.newCircularButton(200f, 200f,   100f, 0);
//		b_target.setTxtreg(Assets.euro);
		b_target.show();
			

		 
		 
					
		
		
		// Initializing variables for first trial
		i_screen_ = 1;
		i_trial_ = 1;
		
		
		screen_onset_time = getTime();
		screen_display_time = 1;
		
		setTime(0f);
		screen_onset_time = getTime();
		screen_display_time = 2;
	}

	
	public void experiment_loop(){
		
		if (i_trial_> N_trials_-1){
			try {
				end_of_exp();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}   
		   
		
		if (b_target.checktouched()){
			b_target.setPosition((float)Math.random()*400, (float)Math.random()*400);
			}	
			
	
	}

  

	
	
	
	
	public ExampleMotor(int i) {
		// TODO Auto-generated constructor stub
	}
	



	public void end_of_exp() throws IOException{	
		dispose();
	}



	@Override
	public void resize(int width, int height) {
		// TODO Auto-generated method stub
		
	}

	
	

}
